/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.sql.*;

/**
 *
 * @author Mathias Olsson
 */
public class DbQueries {

    /**
     * @param args the command line arguments
     */
    public DbQueries() {
        /*
         *Remember to switch IP to the correct one!!!!
         * Password : localpassword
         * User : root
         * Database : travel
         */
    }

    public ResultSet searchTravels(String destination) {
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            String URL = "jdbc:mysql://androidhlm.no-ip.org/travel?user=root&password="; //Tobias Server
            Connection c = DriverManager.getConnection(URL);
            Statement st = c.createStatement();
            ResultSet rs = st.executeQuery("SELECT * FROM travels WHERE Destination='" + destination + "'");
            return rs;


        } catch (Exception e) {
            System.out.println(e);
            return null;
        }

    }
}
